package com.example.theorygame.music;

import android.content.Context;
import android.media.MediaPlayer;

import com.example.theorygame.R;

public class mp {
    private static Context context;
    private static MediaPlayer mediaPlayer;
    //	private static MediaPlayer mediaPlayer1;
//	private static MediaPlayer mediaPlayer2;
    public static boolean isPlay = true;
//	public static boolean isPlay1 = true;
//	public static boolean isPlay2 = true;

    public static void initMedia(Context context) {
        // TODO Auto-generated method stub

        mediaPlayer = MediaPlayer.create(context, R.raw.background);
        mediaPlayer.setLooping(true);//循环播放

    }

    public static void music1(Context context) {
        // TODO Auto-generated method stub
        mediaPlayer = MediaPlayer.create(context, R.raw.random);
        mediaPlayer.setLooping(true);//循环播放
    }

    public static void music2(Context context) {
        // TODO Auto-generated method stub

        mediaPlayer = MediaPlayer.create(context, R.raw.supers);
        mediaPlayer.setLooping(true);//循环播放

    }

    public static void play() {
        mediaPlayer.start();

    }

    public static void stop() {
        mediaPlayer.stop();
        mediaPlayer.release();

    }


}

//	public static boolean getFlag() {
//		return isPlay;
//	}
//	public static void  setFlag(boolean flag) {//设置状态标识
//		if (flag!=isPlay) {
//			if (flag == true) {
//				new Thread(new MusicPlayThread()).start();
//				isPlay = flag;
//			}else {
//				mediaPlayer.release();
//				mediaPlayer.stop();
//				mediaPlayer.seekTo(0);
//				isPlay = flag;
//			}
//		}
//	}
//}

